<template>
  <el-container style="background-color: white">
    <el-header style="background-color: #336688;line-height: 60px">
      <h1 style="font-size: 30px;margin: 0;color: white">烘焙坊后台管理系统
      <span style="float: right">欢迎{{user.nickname}}回来
      <a href="javascript:void (0)" style="color: orange;text-decoration: none;" @click="logout()">退出登录</a>
      </span></h1>
    </el-header>
    <el-container>
      <el-aside width="200px">
        <el-menu router>
          <img src="/imgs/icon.png" style="width: 150px;margin-top: 10px">
          <el-menu-item index="/admin/user">
            <el-icon><User/></el-icon>用户管理
          </el-menu-item>
          <el-menu-item index="/admin/banner">
            <el-icon><Picture/></el-icon>轮播图管理
          </el-menu-item>
          <el-menu-item index="/admin/content">
            <el-icon><ChatLineSquare/></el-icon>内容管理
          </el-menu-item>
        </el-menu>
      </el-aside>
      <el-main><router-view/></el-main>
    </el-container>
  </el-container>
</template>

<script setup>
  import {ref} from "vue";
  import router from "@/router";

  const user=ref(getUser());
  const logout=()=>{
    if (confirm("你确认退出登录吗?")){
      localStorage.clear();
      router.push('/')//返回首页

    }
  }
</script>